package com.nbpt;

import android.content.Intent;
import android.os.CountDownTimer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class WelcomeActivity extends AppCompatActivity {
    TextView tvskip;

    CountDownTimer timer = new CountDownTimer(5000,1000) {
        @Override
        public void onTick(long l) {
            tvskip.setText(l/1000+"秒跳过");
        }

        @Override
        public void onFinish() {
            Intent intent = new Intent(WelcomeActivity.this,MainActivity.class);
            startActivity(intent);
            finish();



        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        timer.start();
        tvskip = findViewById(R.id.tvskip);
    }
    public void gotomain(View view){
        Intent intent = new Intent(WelcomeActivity.this,MainActivity.class);
        startActivity(intent);
        timer.cancel();
        finish();

    }
}
